import React, { Component } from 'react'
import { Input ,Select,Button } from 'antd';
const { Option } = Select;

export default class SearchGoodType extends Component {
    state = {
        inputs:null,
        select:1,
    }
    handleChange = (value) =>{
        this.setState({
            ...this.state,
            select:value
        })
    }
    search = () =>{
        this.props.searchType({
            name:this.state.inputs,
            status:this.state.select,
        })
    }
    clear = () => {
        this.setState({
            ...this.state,
            inputs:null,
        });
        this.props.getAllType()
    }
    render() {
        return (
            <div style={{marginBottom:"15px"}}>
                <label htmlFor="" > 商品类型名称：</label>
                <Input value={this.state.inputs} onChange={(e)=>{this.setState({...this.state,inputs:e.target.value})}} style={{width:"300px",marginRight:"20px"}} placeholder="" />
                <label htmlFor="" style={{marginRight:"5px"}}>状态:</label>
                <Select defaultValue={1} style={{ width: 120 ,marginRight:"25px"}} onChange={this.handleChange}>
      <Option value={1}>启用</Option>
      <Option value={2}>停用</Option>
    </Select>
    <Button type="primary" onClick={this.search} style={{marginRight:"10px"}}>查询</Button>
    <Button onClick={this.clear}>重置</Button>
            </div>
        )
    }
}
